#include <queue>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX_N 100005
int N,C,F;
struct pnode{
    int score , aid ,index;
}cows[MAX_N],cowa[MAX_N];

bool cmpa(const pnode &a ,const pnode &b){
    return a.aid < b.aid;
}

bool cmps(const pnode &a ,const pnode &b){
    return a.score < b.score;
}

int check(int ps){
    int left = 0 , right = 0 , cnt = cows[ps].aid;
    int req = N/2;
    for (int i = 1 ; i <= C; i++){
        if (cowa[i].index < ps && left < req && cnt + cowa[i].aid <=F) {
            cnt += cowa[i].aid;
            left++;
        }
        if (cowa[i].index > ps && right < req && cnt + cowa[i].aid <=F){
            cnt += cowa[i].aid;
            right++;
        }
    }
    if (left < req && right < req) return -1;
    if (left==req && right == req)  return 0;
    if (left < req) return 1;
    if (right < req) return 2;

}


int main(){
    //freopen("2010.txt","r",stdin);
    scanf("%d%d%d",&N,&C,&F);

    for (int i = 1 ; i <= C ; i++){
        scanf("%d%d",&cows[i].score, &cows[i].aid);
        cowa[i] = cows[i];
    }

    sort(cows+1,cows+1+C,cmps);
    for (int i = 1 ; i<= C; i++){
        cows[i].index = i;
        cowa[i] = cows[i];
    }
    sort(cowa+1,cowa+1+C,cmpa);

    int l = 1 , r = C ;
    int ans = -1 , m;
    while (l <= r){
        m = (l+r) >> 1;
        switch(check(m)){
        case -1:
            printf("%d\n",-1);
            return 0;
            break;
        case 0:
            ans = cows[m].score;
            l = m+1;
            break;
        case 1:
            l = m + 1 ;
            break;
        case 2:
            r = m - 1;
            break;
        }
    }

    if (ans != -1) printf("%d\n",ans);
    else printf("-1\n");
    return 0;
}
